package com.example.video

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.base.entity.GoodsEntity
import com.example.base.mvvm.BaseModel
import com.example.base.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class CateXqViewModel:BaseViewModel() {
    val goodsSuccess = MutableLiveData<BaseModel<GoodsEntity>>()
    val goodsFail = MutableLiveData<String>()
    fun cateXq(cid:Int,priceOrder:String,limit:Int,page:Int){
        viewModelScope.launch {
            try {
                goodsSuccess.value =apiServer.cateXq(cid,priceOrder,limit, page)
            }catch (e:Exception){
                goodsFail.value = e.message
            }
        }
    }
}